//
// Created by xili on 2024/9/10 15:55.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    int maxScore(vector<int> &nums) {
        int ans = 0;
        sort(nums.begin(), nums.end(), greater());
        long long sum = 0;
        for (auto &it: nums) {
            sum += it;
            ans += sum > 0 ? 1 : 0;
        }
        return ans;
    }
};